//
//  MPLoginCheckViewController.m
//  WeChatQQStaticLibDemo
//
//  Created by mac on 17/2/9.
//  Copyright © 2017年 srulos. All rights reserved.
//

#import "MPLoginCheckViewController.h"
#import "WeChatQQStaticLibHeader.h"

@interface MPLoginCheckViewController ()
@property (weak, nonatomic) IBOutlet UITextField *textField;

@end

@implementation MPLoginCheckViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"微信登录-验证密码";
    
    self.textField.keyboardType=UIKeyboardTypeNumberPad;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

- (IBAction)onCheckPassword:(id)sender {

    SHOW_HUD(@"正在验证...");
    [[AsyncMPLoginSimulationService stander]asyncCheckPasswordByRandomNum:self.textField.text respBlock:^(MP_LOGIN_RESULT result) {
        HIDE_HUD;
        
        if (result == MLR_SUCCESS) {
            [self.navigationController popToRootViewControllerAnimated:true];
            UIViewController *vc= self.navigationController.presentingViewController;
            while (vc) {
                [vc dismissViewControllerAnimated:false completion:nil];
                vc=vc.presentingViewController;
            }
            
            SHOW_HUD_MESSAGE(@"登录成功！");
        }
        else{
            SHOW_HUD_MESSAGE(@"请输入正确的验证码！");
        }
    }];
}

- (IBAction)onBackScanQRCode:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
}
@end
